<html>
<head><meta charset="utf-8"><title>chapter on async/await and its related magic · t-compiler/wg-rustc-dev-guide · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/index.html">t-compiler/wg-rustc-dev-guide</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html">chapter on async/await and its related magic</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207397711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207397711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mental <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207397711">(Aug 19 2020 at 11:51)</a>:</h4>
<p>Hey folks - I was checking out the dev guide with the intent of figuring out how async/await is handled within rustsc but I couldn't find the chapter on it?</p>
<p>Could someone point me the a resource or some crate in rustc that I could read? I'm very curious as to how it all works :)</p>



<a name="207400796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207400796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207400796">(Aug 19 2020 at 12:31)</a>:</h4>
<p>With <code>rg async src/librustc_*</code> I found</p>
<div class="codehilite"><pre><span></span><code>librustc_ast_passes/feature_gate.rs
622:    gate_all!(async_closure, &quot;async closures are unstable&quot;);

librustc_ast_passes/ast_validation.rs
228:    fn check_trait_fn_not_async(&amp;self, fn_span: Span, asyncness: Async) {

librustc_ast_lowering/item.rs
275:                    let asyncness = header.asyncness;

librustc_ast_lowering/lib.rs
115:    /// When inside an `async` context, this is the `HirId` of the

librustc_ast_lowering/expr.rs
106:                    .make_async_expr(

librustc_ast/ast.rs
1281:    /// An async block (`async move { ... }`).
</code></pre></div>


<p>Maybe take a look around there?</p>



<a name="207400827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207400827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207400827">(Aug 19 2020 at 12:31)</a>:</h4>
<p>also, feel free to bug people to add a chapter about async to the dev guide ;)</p>



<a name="207401106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207401106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mental <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207401106">(Aug 19 2020 at 12:34)</a>:</h4>
<p>cheers <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I grepped for async but a whole bunch of stuff came back and wasn't sure where to start, and yeah I'll try to bring it up more :)</p>



<a name="207401143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207401143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207401143">(Aug 19 2020 at 12:35)</a>:</h4>
<p>yeah you want to be sure to search in <code>librustc_*</code> only or you'll get lots of false positives from clippy</p>



<a name="207401152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207401152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207401152">(Aug 19 2020 at 12:35)</a>:</h4>
<p>(and usually llvm but I don't think they have a lot of async lol)</p>



<a name="207746625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter%20on%20async/await%20and%20its%20related%20magic/near/207746625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/196385-t-compiler/wg-rustc-dev-guide/topic/chapter.20on.20async.2Fawait.20and.20its.20related.20magic.html#207746625">(Aug 22 2020 at 23:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> had written some blog posts about parts of async. My understanding is that much of it desugars away when the HIR is built, but I might be wrong. It might be best to ask on <a class="stream" data-stream-id="182449" href="/#narrow/stream/182449-t-compiler.2Fhelp">#t-compiler/help</a> perhaps</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>